#ifndef MEDIATE_H
#define MEDIATE_H
#include <iostream>
#include "javabean.h"
#include <string>

using namespace std;
class Mediator;
class Person{
PropertyBuilderByName(string,name,private)
PropertyBuilderByName(int,sex,private)
PropertyBuilderByName(int,condition,private)
PointerPropertyBuilderByName(Mediator,m,private)
public:
    Person(string name,int sex,int condition):m_name(name),m_sex(sex),m_condition(condition){

    }
    virtual void getParter(Person *p) = 0;
};

class Mediator{
    PointerPropertyBuilderByName(Person,man,private)
    PointerPropertyBuilderByName(Person,woman,private)
public:
    Mediator(){
       this->m_man=NULL;
       this->m_woman=NULL;
    }

    void Partner(){

        if(m_man->getsex()==m_woman->getsex()){
            cout<<"我不是同性恋"<<endl;
        }
        if(m_man->getcondition()==m_woman->getcondition()){
            cout << m_man->getname() << " 和 " << m_woman->getname() << "绝配" << endl;
        }else{
            cout << m_man->getname() << " 和 " << m_woman->getname() << "不配" << endl;
        }
    }

};


//中介与人的关系，你中有我父，我有你
class Woman:public Person{
    PointerPropertyBuilderByName(Mediator,m,private)
public:
    Woman(string name,int sex,int condition,Mediator *m):m_m(m),Person(name,sex,condition){
        //
    }
public:
    void getParter(Person *p){
        this->getm()->setwoman(this);
        this->getm()->setman(p);
        this->getm()->Partner();
    }
};


class Man:public Person{
    PointerPropertyBuilderByName(Mediator,m,private)
public:
    Man(string name,int sex,int condition,Mediator *m):m_m(m),Person(name,sex,condition){
        //
    }
public:
    void getParter(Person *p){
        this->getm()->setman(this);
        this->getm()->setwoman(p);
        this->getm()->Partner();
    }
};
#endif // MEDIATE_H
